package redis_springboot.demo.mq.consumer;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
import redis_springboot.demo.mq.MQConst;

import java.time.LocalDateTime;

/**
 * @author： pang-yun
 * @date： 2021-12-24 15:54
 * 功能目的 ：用于 延时队列的消息消费类
 */

@Slf4j
@Component
public class DelayedQueueConsumer {
    @RabbitListener(queues = MQConst.DELAY_QUEUE)
    public void receive(Message message){
        String msg = message.getBody().toString();
        log.info("当前时间: {}, 收到死信队列的消息: {}", LocalDateTime.now().toString(),msg);
    }



}
